*ALTERNATIVE RD SPECIFICATIONS

*Prints tables relative to subsection B.2.2.4 in SI

clear all
use "ESS.dta" 


*DISCRIMINATORY ETHNORACIAL ATTITUDES

gen D=D_race
gen PD=PD_race
 label var D "Discriminatory attitudes"
 label var PD "Perceptions of discrimination"

 
 global y1 "D"
 global y2 "PD" 
 global x1 "total_eduyrs"
 global z1 "Age Age2 Female Edu_mum  i.Country  i.essround"
 global z2 " Female  Edu_mum i.Country  i.essround"
 global IV "T r"
 global z1b "Age Age2 Female Edu_mum Africa Asia Muslim Jew i.Country  i.essround"
 global z2b " Female  Edu_mum i.Country Africa Asia Muslim Jew  i.essround"
 
drop total_eduyrs
gen total_eduyrs=eduyrs
la var total_eduyrs "Years of education"
global x1 "total_eduyrs"

*KERNEL 


quietly: rdbwselect  $y1  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) kernel(epanechnikov)
local ub =floor(e(h_mserd))
g w=max(0,`ub'-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store kernel
mat l e(first)
local Fb= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb=trim("`Mean'")
drop w



quietly: rdbwselect  $y1  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) kernel(uniform)
local uc =floor(e(h_mserd))
g w=max(0,`uc'-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store uniform
mat l e(first)
local Fc= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc=trim("`Mean'")
drop w


esttab  kernel uniform, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("kernel" "uniform" )  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Ethnoracial D, alternative kernel)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 

**ALTERNATIVE POLYNOMIAL ORDER

quietly: rdbwselect  $y1  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) 
local ub2 =floor(e(h_mserd))
g w=max(0,`ub2'-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store second
mat l e(first)
local Fb2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb2= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb2=trim("`Mean'")
drop w


quietly: rdbwselect  $y1  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) 
local uc2 =floor(e(h_mserd))
g w=max(0,`uc2'-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store third
mat l e(first)
local Fc2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc2= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc2=trim("`Mean'")
drop w

esttab  second third, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("second order" "third order" )  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Ethnoracial D, alternative polynomial)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 



*** BANDWIDTHS VARYNG SIZE



g w=max(0,10-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store ten
mat l e(first)
local Fa2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Na2= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meana2=trim("`Mean'")
drop w


g w=max(0,15-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store fifteen
mat l e(first)
local Fb2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb2= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb2=trim("`Mean'")
drop w

g w=max(0,20-abs(r))  

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store twenty
mat l e(first)
local Fc2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc2= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc2=trim("`Mean'")
drop w


esttab  ten fifteen twenty, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("ten" "fifteen" "twenty")  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Ethnoracial D, alternative bandwidth)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 

 
 


*********************************************************************************************************



*PERCETIONS OF  ETHNORACIAL   DISCRIMINATION


clear all
use "ESS.dta" 


 
drop total_eduyrs
gen total_eduyrs=eduyrs
la var total_eduyrs "Years of education"
global x1 "total_eduyrs"
 
la var total_eduyrs "Years of education"


gen D=D_race
gen PD=PD_race
 label var D "Discriminatory attitudes"
 label var PD "Perceptions of discrimination"

 
 global y1 "D"
 global y2 "PD" 
 global x1 "total_eduyrs"
 global z1 "Age Age2 Female Edu_mum  i.Country  i.essround"
 global z2 " Female  Edu_mum i.Country  i.essround"
 global z1b "Age Age2 Female Edu_mum Africa Asia Muslim Jew i.Country  i.essround"
 global z2b " Female  Edu_mum i.Country Africa Asia Muslim Jew  i.essround"

 
drop total_eduyrs
gen total_eduyrs=eduyrs
la var total_eduyrs "Years of education"
global x1 "total_eduyrs"


*KERNEL

quietly: rdbwselect  $y2  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) kernel(epanechnikov)
local ub =floor(e(h_mserd))
g w=max(0,`ub'-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store kernel
mat l e(first)
local Fb= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb=trim("`Mean'")
drop w


quietly: rdbwselect  $y2  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) kernel(uniform)
local uc =floor(e(h_mserd))
g w=max(0,`uc'-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store uniform
mat l e(first)
local Fc= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc=trim("`Mean'")
drop w


esttab  kernel uniform, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("kernel" "uniform" )  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Ethnoracial PD, alternative kernel)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 


**ALTERNATIVE POLYNOMIAL ORDER

quietly: rdbwselect  $y2  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) 
local ub2 =floor(e(h_mserd))
g w=max(0,`ub2'-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store second
mat l e(first)
local Fb2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb2= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb2=trim("`Mean'")
drop w


quietly: rdbwselect  $y2  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) 
local uc2 =floor(e(h_mserd))
g w=max(0,`uc2'-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store third
mat l e(first)
local Fc2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc2= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc2=trim("`Mean'")
drop w

esttab  second third, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("second order" "third order" )  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Ethnoracial PD, alternative polynomial)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 



*** BANDWIDTHS VARYNG SIZE



g w=max(0,10-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store ten
mat l e(first)
local Fa2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Na2= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meana2=trim("`Mean'")
drop w


g w=max(0,15-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store fifteen
mat l e(first)
local Fb2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb2= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb2=trim("`Mean'")
drop w

g w=max(0,20-abs(r))  

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store twenty
mat l e(first)
local Fc2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc2= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc2=trim("`Mean'")
drop w


esttab  ten fifteen twenty, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("ten" "fifteen" "twenty")  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Ethnoracial PD, alternative bandwidth)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 

 
 
 
 ************GENDER
 
 *ALTERNATIVE RD SPECIFICATIONS


cd "/Users/marcogiani/Dropbox/World Politics/Stata/"
clear all
use "Do and data files/Final.dta" 

*DISCRIMININATORY GENDER ATTITUDES

gen D=D_gender
gen PD=PD_gender
 label var D "Discriminatory attitudes"
 label var PD "Perceived discrimination"

 
 global y1 "D"
 global y2 "PD" 
 global x1 "total_eduyrs"
 global z1 "Age   Edu_mum  i.Country  i.essround"
 global z2 "Edu_mum i.Country  i.essround"
 
drop total_eduyrs
gen total_eduyrs=eduyrs
la var total_eduyrs "Years of education"
global x1 "total_eduyrs"

*KERNEL 


quietly: rdbwselect  $y1  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) kernel(epanechnikov)
local ub =floor(e(h_mserd))
g w=max(0,`ub'-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store kernel
mat l e(first)
local Fb= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb=trim("`Mean'")
drop w



quietly: rdbwselect  $y1  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) kernel(uniform)
local uc =floor(e(h_mserd))
g w=max(0,`uc'-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store uniform
mat l e(first)
local Fc= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc=trim("`Mean'")
drop w


esttab  kernel uniform, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("kernel" "uniform" )  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Gender D, alternative kernel)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 

**ALTERNATIVE POLYNOMIAL ORDER

quietly: rdbwselect  $y1  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) 
local ub2 =floor(e(h_mserd))
g w=max(0,`ub2'-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store second
mat l e(first)
local Fb2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb2= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb2=trim("`Mean'")
drop w


quietly: rdbwselect  $y1  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) 
local uc2 =floor(e(h_mserd))
g w=max(0,`uc2'-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store third
mat l e(first)
local Fc2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc2= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc2=trim("`Mean'")
drop w

esttab  second third, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("second order" "third order" )  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Gender D, alternative polynomial)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 



*** BANDWIDTHS VARYNG SIZE



g w=max(0,10-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store ten
mat l e(first)
local Fa2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Na2= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meana2=trim("`Mean'")
drop w


g w=max(0,15-abs(r)) 

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store fifteen
mat l e(first)
local Fb2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb2= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb2=trim("`Mean'")
drop w

g w=max(0,20-abs(r))  

quietly: ivreg2  $y1  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store twenty
mat l e(first)
local Fc2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc2= e(N)
su  $y1 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc2=trim("`Mean'")
drop w


esttab  ten fifteen twenty, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("ten" "fifteen" "twenty")  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Gender D, alternative bandwidth)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 

 
 


*********************************************************************************************************



*PERCEPTIONS OF GENDER  DISCRIMINATION


clear all
use "ESS.dta" 


 
drop total_eduyrs
gen total_eduyrs=eduyrs
la var total_eduyrs "Years of education"
global x1 "total_eduyrs"
 
la var total_eduyrs "Years of education"


gen D=D_gender
gen PD=PD_gender
 label var D "Discriminatory attitudes"
 label var PD "Perceived discrimination"

 
 global y1 "D"
 global y2 "PD" 
 global x1 "total_eduyrs"
 global z1 "Age   Edu_mum  i.Country  i.essround"
 global z2 "   Edu_mum i.Country  i.essround"
 

 
drop total_eduyrs
gen total_eduyrs=eduyrs
la var total_eduyrs "Years of education"
global x1 "total_eduyrs"


*KERNEL

quietly: rdbwselect  $y2  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) kernel(epanechnikov)
local ub =floor(e(h_mserd))
g w=max(0,`ub'-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store kernel
mat l e(first)
local Fb= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb=trim("`Mean'")
drop w


quietly: rdbwselect  $y2  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) kernel(uniform)
local uc =floor(e(h_mserd))
g w=max(0,`uc'-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store uniform
mat l e(first)
local Fc= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc=trim("`Mean'")
drop w


esttab  kernel uniform, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("kernel" "uniform" )  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Gender PD, alternative kernel)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 


**ALTERNATIVE POLYNOMIAL ORDER

quietly: rdbwselect  $y2  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) 
local ub2 =floor(e(h_mserd))
g w=max(0,`ub2'-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store second
mat l e(first)
local Fb2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb2= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb2=trim("`Mean'")
drop w


quietly: rdbwselect  $y2  r if Strong==1,  covs(Edu_mum Female  r1 r2 r3 r4 r5 r6 r7 r8 c1 c2 c3 c4 c5 c6 c7 c8 c9  c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 ) 
local uc2 =floor(e(h_mserd))
g w=max(0,`uc2'-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store third
mat l e(first)
local Fc2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc2= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc2=trim("`Mean'")
drop w

esttab  second third, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("second order" "third order" )  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Gender PD, alternative polynomial)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 



*** BANDWIDTHS VARYNG SIZE



g w=max(0,10-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store ten
mat l e(first)
local Fa2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Na2= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meana2=trim("`Mean'")
drop w


g w=max(0,15-abs(r)) 

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store fifteen
mat l e(first)
local Fb2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nb2= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanb2=trim("`Mean'")
drop w

g w=max(0,20-abs(r))  

quietly: ivreg2  $y2  ($x1 = $IV)   $z2  [pweight=w] if Strong==1, first  baselevels robust   gmm2s  
est store twenty
mat l e(first)
local Fc2= floor(e(first)[rownumb(e(first),"SWF"),1])
local Nc2= e(N)
su  $y2 if e(sample), mean
loc Mean:di%8.2fc r(mean)
loc Meanc2=trim("`Mean'")
drop w


esttab  ten fifteen twenty, replace se star(* 0.1 ** 0.05 *** 0.01) obslast collabels(, none)   wrap  legend  gaps nolz  booktabs mlabel("ten" "fifteen" "twenty")  nonumbers  cells(b(star fmt(3)  ) se(fmt(3) par  )) compress label title(Gender PD, alternative bandwidth)   drop(  _cons *.Country  *.essround)      stats(  CountryFE  TimeFE Sociodemographics   Estimator N r2  widstat  , fmt(a1 a2 a3   a5 %9.0fc  2 %9.0fc  1  )  labels( `"Country FE"'  `"Time FE"' `"Sociodemographics"'   `"Estimator"' `"N.obs"' `"\(R^{2}\)"'  `"\(F\)-statistics"'   ) ) 

 
 







